home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4985 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: void main() and other atrocities!
  5. Date: 10 Feb 1996 19:25:28 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4fjnj8INNh3k@keats.ugrad.cs.ubc.ca>
  8. References: <4eduaj$1aq@grouper.Exis.Net> <4f7ifv$8l4@airdmhor.gen.nz> <4fg97qINNnug@keats.ugrad.cs.ubc.ca> <BLUME.96Feb9164215@zayin.cs.princeton.edu>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <BLUME.96Feb9164215@zayin.cs.princeton.edu>,
  12. Matthias Blume <blume@zayin.cs.princeton.edu> wrote:
  13. >In article <4fg97qINNnug@keats.ugrad.cs.ubc.ca> c2a192@ugrad.cs.ubc.ca
  14. >(Kazimir Kylheku) writes:
  15. >
  16. >   Hence, declaring a void main(), while it is a
  17. >   transgression, is not a very serious error.
  18. >
  19. >No, no, and no!  It _is_ a serious error.  Don't spread false
  20. >information, please!  The C compiler is free to generate different
  21. >function *calling* (as opposed to "return") sequences for functions
  22. >declared as returning void and returning int.  In this case already
  23. >the call to a "void" main can break something.
  24.  
  25. Right, and as has been discussed before, most compilers are tacitly designed so
  26. that all the code out there which breaks the int main() rule works properly.
  27.  
  28. Why I said that it is not a serious error is because it only affects the
  29. individual who is trying to compile one particular program. In case it doesn't
  30. work, it doesn't take a whole lot longer than ten seconds to correct. Most
  31. projects will not have more than just a small number main() routines.
  32.  
  33. >Why, on earth, is it so hard to accept the fact that declaring main as
  34. >returning anything other than int in a hosted environment is ILLEGAL?
  35. >It *is* illegal.  Period.
  36.  
  37. Yes, but that does not make it serious. Stealing a candy from the grocery store
  38. is illegal, but hardly a grand felony. ;)
  39.  
  40. There are more important issues in programming than worrying about correct
  41. declarations for main(). This should be a matter of good habit.
  42.  
  43. -- 
  44.  
  45.